package com.ysd.lis.controller.bac;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.bac.BacPublisSecReport;
import com.ysd.lis.entity.bac.BacPublisSecReport;
import com.ysd.lis.entity.bac.BacStainingResult;
import com.ysd.lis.mapper.bac.BacStainingResultMapper;
import com.ysd.lis.service.bac.BacPublisSecReportService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.List;

/**
 * <p>
 * 药敏结果模板 前端控制器
 * </p>
 *
 * @author cfz
 * @since 2024-03-28
 */
@RestController
@RequestMapping("/api/bac/bacPublisSecReport")
public class BacPublisSecReportController extends BaseController {
    @Autowired
    BacPublisSecReportService bacPublisSecReportService;

    @ApiOperation("查询")
    @GetMapping("/findBacPublisSecReportList")
    public Result findBacPublisSecReportList(BacPublisSecReport bacPublisSecReport) {
        LambdaQueryWrapper<BacPublisSecReport> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        List<BacPublisSecReport> list = bacPublisSecReportService.list(lambdaQueryWrapper);
        return Result.succ(1, "查询成功", list);
    }

    @ApiOperation("批量增加")
    @PostMapping("/batchSavePublisSecReport")
    public Result batchSavePublisSecReport(@RequestBody List<BacPublisSecReport> bacPublisSecReports) {
        boolean b = bacPublisSecReportService.saveBatch(bacPublisSecReports);
        if (b) {
            return Result.succ(1, "添加成功", "");
        }
        return Result.fail("添加失败");
    }


    @ApiOperation("批量修改")
    @PostMapping("/batchEditPublisSecReport")
    public Result batchEditPublisSecReport(@RequestBody List<BacPublisSecReport> bacPublisSecReports) throws JsonProcessingException {
        return bacPublisSecReportService.batchEditPublisSecReport(bacPublisSecReports);
    }

    @ApiOperation("撤销涂片报告")
    @PostMapping("/batchEditRevokeSecReport")
    public Result batchEditRevokeSecReport(@RequestBody BacPublisSecReport bacPublisSecReports){
        return bacPublisSecReportService.batchEditRevokeSecReport(bacPublisSecReports);
    }
    @ApiOperation("批量撤销审核")
    @PostMapping("/batchCancelSecReport")
    public Result batchCancelSecReport(@RequestBody List<BacPublisSecReport> bacPublisSecReports) throws JsonProcessingException {
        return bacPublisSecReportService.batchCancelSecReport(bacPublisSecReports);
    }

    @ApiOperation("获取历史报告")
    @PostMapping("/getBacPublisSecReports")
    public Result getBacPublisSecReports(@RequestBody BacPublisSecReport bacPublisSecReport) {
        return bacPublisSecReportService.getBacPublisSecReports(bacPublisSecReport);
    }

    @ApiOperation("取消报告")
    @PostMapping("/cancelPublisSecReport")
    public Result cancelPublisSecReport(@RequestBody BacPublisSecReport bacPublisSecReport) {
        return bacPublisSecReportService.cancelPublisSecReport(bacPublisSecReport);
    }

    @ApiOperation("删除报告")
    @PostMapping("/deletePublisSecReport")
    public Result deletePublisSecReport(@RequestBody BacPublisSecReport bacPublisSecReport) {
        return bacPublisSecReportService.deletePublisSecReport(bacPublisSecReport);
    }
}
